<?php $this->load->view('home/layout/header') ?>
    <div class="pz-dog widthMax <?php echo ($lottery->lottery_id == 71) ? 'pz-draw-71' : ''; ?> ">
        <?php $page3 = empty($lottery->page3) ? '' : json_decode($lottery->page3);?>
        <?php if ( !empty($page3->ad_image)) : ?>
        <a href="<?php echo $page3->ad_links ? $page3->ad_links : 'javascript:;'; ?>" class="duanwu">
            <img src="<?php echo $this->config->show_image_url($page3->ad_image);?>" /><span class="close"><i class="iconfont">&#xe62f;</i></span>
        </a>
        <?php endif;?>

        <a href="<?php echo isset($_SERVER['HTTP_REFERER']) ? 'javascript:history.go(-1);' : site_url('home/lottery/index'); ?>" class="drax-return">
            <i class="iconfont icon-zuojiantou"></i>
        </a>
        <a href="<?php echo site_url('home/ucenter/index'); ?>" class="drax-beizhu">
            <i class="iconfont">&#xe616;</i>
        </a>
        <a href="javascript:;" class="drax-spread"></a>
        <?php $page3 = $lottery->page3 ? json_decode($lottery->page3) : ''; ?>
        <div class="pz-draw">

            <h1>
                <p><?php echo empty($page3->title1) ? '幸运大转盘' : $page3->title1; ?></p>
                <p><?php echo empty($page3->title2) ? '天天抽奖不打烊' : $page3->title2; ?></p>
            </h1>
            <a href="<?php echo site_url('home/discountMall/show'); ?>" class="draw-mall flex">
                <i class="draw-in iconfont">&#xe645;</i>
                <p class="flex-1">积分商城</p>
                <i class="draw-on iconfont">&#xe624;</i>
            </a>
            <div class="pz-chance">
                你今天还有<span><?php echo $lotterySum;?></span>次抽奖机会
            </div>
            <div class="pzCanvas">
                <canvas id='pzCanvas'></canvas>
                <div class="turnplate">
                <?php if ($lottery->lottery_id == 71) : ?>
                    <img src="<?php echo $lotterySum > 0 ? 'images/turnplate-pointer-1.png' : 'images/grayArrow-1.png'; ?>" class="pzclick"> <!-- 砸金蛋 -->
                <?php else : ?>
                    <img src="<?php echo $lotterySum > 0 ? 'images/turnplate-pointer.png' : 'images/grayArrow.png'; ?>" class="pzclick"> <!-- 抽奖 -->
                <?php endif; ?>
                </div>
            </div>
            <div class="draw-botton am-cf">
                <a href="<?php echo site_url('home/winners/grid'), '?id=', $lottery->lottery_id; ?>" class="draw-left">
                    我的奖品
                </a>
                <button type="button" class="draw-right" data-am-modal="{target: '#my-details'}">
                    抽奖规则
                </button>
            </div>
        </div>
        <div class="draw-text flex">
            <div class="flex-1">
                <h4>奖项设置：</h4>
                <?php foreach($prize as $key=>$value) : ?>
                <p><?php echo numberToZhUpper($key+1),'等奖：', $value->prize_name; ?></p>
                    <?php if ($value->links && $value->type != 3 ) : ?>
                    <a href="<?php echo $value->links; ?>" class="more am-cf">
                        <span>去奖品站点看看</span>
                        <i>></i>
                    </a>
                    <?php endif; ?>
                <?php endforeach; ?>
            </div>
            <div class="drax-img">
                <img src="/skins/home/images/choujiang_1.jpg">
            </div>
        </div>
        <div class="draw-marquee">
            <div class="marquee-name flex" id="winningList">
                <h5>中奖名单</h5>
            </div>
        </div>
    </div>
    <div class="draw-footer">
        <ul class="flex">
            <li>
                <a href="<?php echo site_url('home/apply/applyLottery'); ?>">
                    <i class="iconfont">&#xe659;</i>
                    <p>创建抽奖</p>
                </a>
            </li>
            <li>
                <a href="<?php echo site_url('home/apply/applySpread'); ?>">
                    <i class="iconfont">&#xe61d;</i>
                    <p>产品推广</p>
                </a>
            </li>
            <li>
                <a href="<?php echo site_url('home/apply/applySeller'); ?>">
                    <i class="iconfont">&#xe61e;</i>
                    <p>我要分销</p>
                </a>
            </li>
            <li>
                <a href="<?php echo site_url('home/apply/applyProvider'); ?>">
                    <i class="iconfont">&#xe646;</i>
                    <p>我要供应</p>
                </a>
            </li>
        </ul>
    </div>
    <div class="details-modal am-modal" tabindex="-1" id="my-details">
        <div class="details-winning widthMax">
            <a href="javascript: void(0)" class="details-close" data-am-modal-close>&times;</a>
            <div class="details-text">
                <h6>抽奖规则</h6>
                <p>1、用户可关注本抽奖通道或登录<a href="<?php echo site_url(); ?>">平台</a>,每天到抽奖页面免费抽奖，如当天未抽中，次日还可抽取。</p>
                <p>2、用户首次验证成功后，即可天天免登录参与抽奖。</p>
                <p>3、抽中的奖品可在“我的奖品”中查看。</p>
                <p>4、本次抽奖技术由公司提供，如抽奖活动由公司创建，其最终解释权归公司所有，由商家创建的抽奖活动，最终解释权则归商家所有，具体请参考活动详情说明。</p>
                <h6>兑奖规则</h6>
                <p>1、抽中的实物奖品，用户在获奖页面填写收货地址，由客服电话确认后寄送发放，如抽中现场颁发的奖品，请根据活动提示到指定颁奖点现场领奖。</p>
                <p>2、其他虚拟奖品，根据提示领奖成功后可立即使用，抽中积分的用户，可到<a href="<?php echo site_url(); ?>">平台</a>积分商城用积分兑换产品或抵扣部分产品款。</p>
                <p>3、抽中的奖品须在有效期内领取，有效期详见活动详情，到期后自动失效，用户领取奖品后请尽快使用，具体使用期限请参考奖品使用说明。</p>
                <p>4、免责申明：凡由公司创建的抽奖活动，其奖品的真实有效性均由公司承担，由商家创建的活动，其奖品的真实性则由商家自行负责，如有疑问请致电客服热线400-0571-648。</p>
                <p>特别推荐：<a href="<?php echo site_url(); ?>">本平台网</a>是一个为顾客提供吃、住、游、购、娱一站式服务的平台，欢迎广大用户来平台体验。</p>
            </div>
        </div>
    </div>
    <!-- 中奖了 -->
    <div class="draw-modal am-modal" tabindex="-1" id="my-true">
      <div class="draw-winning">
        <div class="widthMax draw-cleos">
            <img src="/skins/home/images/zhongjiao.png">
            <a href="javascript: void(0)" class="draw-close" data-am-modal-close>&times;</a>
            <div class="draw-botrue">
                <div class="botrue-img">
                    <img src="/skins/home/images/you.png">
                </div>
                <div class="botrue-text">
                    <h5>
                        <i>300</i>
                        <span>积分</span>
                    </h5>
                    <p>
                        期待让人更努力<br/>
                        您还有2次机会
                    </p>
                    <div class="draw-details">
                        <a class="first" href="javascript: void(0)" data-am-modal-close>
                            继续抽奖
                        </a>
                        <a href="<?php echo site_url('home/winners/grid'); ?>">
                            马上领奖
                        </a>
                    </div>
                </div>
            </div>
            <!-- <div class="draw-log">
                <img src="/skins/home/images/log.png">
            </div> -->
        </div>
      </div>
    </div>

    <!-- 中奖了 最后一次 -->
    <div class="draw-modal am-modal" tabindex="-1" id="my-true-end">
      <div class="draw-winning">
        <div class="widthMax draw-cleos">
            <img src="/skins/home/images/zhongjiao.png">
            <a href="javascript: void(0)" class="draw-close" data-am-modal-close>&times;</a>
            <div class="draw-botrue">
                <div class="botrue-img">
                    <img src="/skins/home/images/you.png">
                </div>
                <div class="botrue-text">
                    <h5>
                        <i>300</i>
                        <span>积分</span>
                    </h5>
                    <p>
                        期待让人更努力<br/>
                        您还有2次机会
                    </p>
                    <div class="draw-details">
                        <a class="first" href="<?php echo site_url('home/winners/grid'); ?>">
                            查看奖品
                        </a>
                        <a href="<?php echo site_url();?>">去首页</a>
                    </div>
                </div>
            </div>
            <!-- <div class="draw-log">
                <img src="/skins/home/images/log.png">
            </div> -->
        </div>
      </div>
    </div>

        <!-- 未中奖 -->
    <div class="draw-modal am-modal" tabindex="-1" id="my-false">
      <div class="draw-winning false-winning">
        <div class="widthMax draw-cleos">
            <img src="/skins/home/images/false.png">
            <a href="javascript: void(0)" class="draw-close" data-am-modal-close>&times;</a>
            <div class="draw-botrue draw-false"></div>

            <div class="draw-details">
                <a href="javascript: void(0)" class="only" data-am-modal-close>
                    继续抽奖
                </a>
            </div>
            <!-- <div class="draw-log">
                <img src="/skins/home/images/log.png">
            </div> -->
        </div>
      </div>
    </div>

    <!-- 未中奖 并且最后一次 -->
    <div class="draw-modal am-modal" tabindex="-1" id="my-last">
      <div class="draw-winning false-winning">
        <div class="widthMax draw-cleos">
            <img src="/skins/home/images/false.png">
            <a href="javascript: void(0)" class="draw-close" data-am-modal-close>&times;</a>
            <div class="draw-botrue draw-false"></div>

            <div class="draw-details">
                <a class="first" href="<?php echo site_url('home/winners/grid'); ?>">
                    查看奖品
                </a>
                <a href="<?php echo site_url();?>">去首页</a>
            </div>
            <!-- <div class="draw-log">
                <img src="/skins/home/images/log.png">
            </div> -->
        </div>
      </div>
    </div>

    <style type="text/css">
        .am-dimmer{background-color: rgba(0,0,0,.78);}
    </style>
<?php $this->load->view('home/layout/footer') ?>

<?php js('home', 'awardRotate'); ?>
<?php js('home', 'modernizr-custom.min'); ?>
<?php js('home', 'Canvas', 20160528); ?>
<?php js('home', 'pages/lottery')?>
<script type="text/javascript">
    var prizeName = [];
    var colors = [];
    var code = [];
    <?php foreach($prizeArr as $key=>$value) : ?>
    prizeName.push("<?php echo $value['name']; ?>");
    code.push(<?php echo $value['id']; ?>);
    colors.push("<?php echo $value['color'];?>");
    <?php endforeach; ?>
var turnplate = {
    restaraunts:prizeName ,                 //大转盘奖品名称
    colors:colors,                      //大转盘奖品区块对应背景颜色
    code:code,
    startAngle:0,       //开始角度
    bRotate:false,      //false:停止;ture:旋转
    angleSpeet:5,
    rotateSum:<?php echo $lotterySum > 0 ? $lotterySum : 0; ?>
};

$(function(){
    if($('.duanwu').length>0){
        $('.drax-return, .drax-beizhu').css('top','3.857rem');
        $('a.duanwu .close').on('click',function(){
            $(this).parents('.duanwu').addClass('duanwuHide');
            $('.drax-return, .drax-beizhu').css('top','1rem');
            return false;
        });
    }
});
</script>